/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author ivanhoe
 */
@Entity
@Table(name = "detalle_venta")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "DetalleVenta.findAll", query = "SELECT d FROM DetalleVenta d"),
    @NamedQuery(name = "DetalleVenta.findByIdDetalleVenta", query = "SELECT d FROM DetalleVenta d WHERE d.idDetalleVenta = :idDetalleVenta"),
    @NamedQuery(name = "DetalleVenta.findByDescDetalleVenta", query = "SELECT d FROM DetalleVenta d WHERE d.descDetalleVenta = :descDetalleVenta")})
public class DetalleVenta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_detalle_venta")
    private Integer idDetalleVenta;
    @Size(max = 45)
    @Column(name = "desc_detalle_venta")
    private String descDetalleVenta;
    @JoinColumn(name = "tipo_detalle_venta_id_tipo_detalle_venta", referencedColumnName = "id_tipo_detalle_venta")
    @ManyToOne(optional = false)
    private TipoDetalleVenta tipoDetalleVentaIdTipoDetalleVenta;
    @JoinColumn(name = "ventas_id_venta", referencedColumnName = "id_venta")
    @ManyToOne(optional = false)
    private Ventas ventasIdVenta;

    public DetalleVenta() {
    }

    public DetalleVenta(Integer idDetalleVenta) {
        this.idDetalleVenta = idDetalleVenta;
    }

    public Integer getIdDetalleVenta() {
        return idDetalleVenta;
    }

    public void setIdDetalleVenta(Integer idDetalleVenta) {
        this.idDetalleVenta = idDetalleVenta;
    }

    public String getDescDetalleVenta() {
        return descDetalleVenta;
    }

    public void setDescDetalleVenta(String descDetalleVenta) {
        this.descDetalleVenta = descDetalleVenta;
    }

    public TipoDetalleVenta getTipoDetalleVentaIdTipoDetalleVenta() {
        return tipoDetalleVentaIdTipoDetalleVenta;
    }

    public void setTipoDetalleVentaIdTipoDetalleVenta(TipoDetalleVenta tipoDetalleVentaIdTipoDetalleVenta) {
        this.tipoDetalleVentaIdTipoDetalleVenta = tipoDetalleVentaIdTipoDetalleVenta;
    }

    public Ventas getVentasIdVenta() {
        return ventasIdVenta;
    }

    public void setVentasIdVenta(Ventas ventasIdVenta) {
        this.ventasIdVenta = ventasIdVenta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDetalleVenta != null ? idDetalleVenta.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleVenta)) {
            return false;
        }
        DetalleVenta other = (DetalleVenta) object;
        if ((this.idDetalleVenta == null && other.idDetalleVenta != null) || (this.idDetalleVenta != null && !this.idDetalleVenta.equals(other.idDetalleVenta))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.DetalleVenta[ idDetalleVenta=" + idDetalleVenta + " ]";
    }
    
}
